package controller.action;

import java.io.File;
import java.io.InputStream;

import model.service.ExamineeService;
import model.service.ScoreService;

import com.opensymphony.xwork2.ActionSupport;

public class DownloadFinalScoreExcel extends ActionSupport {
	private String result;
	private String Info;
	private ScoreService scoreService;
	private InputStream inputStream;
	
	
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getInfo() {
		return Info;
	}
	public void setInfo(String info) {
		this.Info = info;
	}
	public ScoreService getScoreService() {
		return scoreService;
	}
	public void setScoreService(ScoreService scoreService) {
		this.scoreService = scoreService;
	}
	public InputStream getInputStream() {
		return inputStream;
	}

	public String downLoad(){
		setInfo("userId#finalScore");
		File file = new File(ExamineeService.basePath+"scoreExcel/");
		if(!file.exists())
		{
			file.mkdirs();
		}
		inputStream=scoreService.ScoreToExcel(scoreService.basePath+"scoreExcel/score.xls", Info);
		if(inputStream==null)
			return ERROR;
		return SUCCESS;
	}
	
	
}
